<div id="alertmsg"></div>
<div id="formpost">    
    <form method="post" action="<?php echoAction('addcontactus')?>" onsubmit="checkform(this);return false">       
        <input type="hidden" name="opt" value="addcontactus" /> 
        <table border="0" cellspacing="5" width="100%">
            <tr>
                <td width="120"><?php echo getLang("Full Name");?>: <span class="sao1">*</span></td>
                <td colspan="2">
                    <input name="Name" id="Name" class="tfield" />
                </td>
            </tr>
            <tr>
                <td><?echo getLang("Email")?>: <span class="sao1">*</span></td>
                <td colspan="2">
                    <input name="Email" id="Email" class="tfield"/>
                </td>
            </tr>
            <tr>
                <td ><?echo getLang("Subject")?>: <span class="sao1">*</span></td>
                <td colspan="2">
                    <input name="Subject" id="Subject" class="tfield" />
                </td>
            </tr>
            <tr>
                <td ><?echo getLang("Your Message")?>: <span class="sao1">*</span></td>
                <td colspan="2">
                    <textarea class="tfield" name="Message" id="Message"></textarea>        		
                </td>
            </tr>
            <tr>
                <td ><?echo getLang("Spam Code")?>: <span class="sao1">*</span></td>
                <td colspan="2">
                    <input class="tfield" maxlength="5" style="width: 50px;" name="SpamCode" id="SpamCode" />
                <?php echoImgSpam('ImgSpamcode')?>
                </td>
            </tr>	
            <tr>
                <td align="right" style="padding-top:15">&nbsp;</td>
                <td colspan="2" style="padding-top:10px">
                    <input type="submit" class="submit" id="butsend" style="float: left;" value="<?echo getLang("Send")?>" />
                </td>
            </tr>
        </table>  
    </form>
</div>
<script type="text/javascript">
var ajpost      = new ajaxLoader();
function checkform(fox)
{
	if(fox.Name.value=="")
	{
		Talert("<?php echo getLang('Please enter your name')?>");
		fox.Name.focus();
		return false;
	}
	if(!isEmail(fox.Email.value))
	{
		Talert("<?php echo getLang('Please enter your email')?>");
        fox.Email.focus();
        return false;
	}	
	if(fox.Subject.value=="")
	{
		Talert("<?php echo getLang('Please enter subject')?>");
		fox.Subject.focus();
		return false;
	}
	
	if(fox.Message.value=="")
	{
		Talert("<?php echo getLang('Please enter Message')?>");
		fox.Message.focus();
		return false;
	} 
	if(fox.SpamCode.value == "")
 	{
 		Talert("<?php echo getLang('Please enter spam code')?>");		
 		fox.SpamCode.focus();
 		return false;
 	}	
    ajpost.init({url: fox.action,func:postsuccess});
    ajpost.send(fox,true);
    getId('butsend').value="<?php echo getLang('Sending')?>...";
    Talert('');
}       
function postsuccess(obj)
{
    getId('butsend').value="<?php echo getLang('Send')?>";
    if(obj.status=='ok')
    {
        getId('formpost').innerHTML='';
    }
    else
    {
        getId('SpamCode').value='';
        getId('SpamCode').focus();
        getId('ImgSpamcode').change();        
    }
    Talert(obj.msg);
}
</script>
